package org.dromara.Nyt7PlotDetailInfo.mapper;

import org.apache.ibatis.annotations.Select;
import org.dromara.Nyt7PlotDetailInfo.domain.Nyt7PlotDetailInfo;
import org.dromara.Nyt7PlotDetailInfo.domain.Nyt7PlotDetailInfoEx;
import org.dromara.Nyt7PlotDetailInfo.domain.vo.Nyt7PlotDetailInfoVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;

/**
 * 地块详细信息Mapper接口
 *
 * @author Lion Li
 * @date 2024-12-27
 */
public interface Nyt7PlotDetailInfoMapper extends BaseMapperPlus<Nyt7PlotDetailInfo, Nyt7PlotDetailInfoVo> {
    @Select("SELECT d.*,f.id AS 'farmer_insurance_info.id',\n" +
        "f.farmer_name AS 'farmer_insurance_info.farmer_name',\n" +
        "f.farmer_id_card AS 'farmer_insurance_info.farmer_id_card',\n" +
        "f.plot_count AS 'farmer_insurance_info.plot_count',\n" +
        "f.measured_area AS 'farmer_insurance_info.measured_area',\n" +
        "f.insured_area AS 'farmer_insurance_info.insured_area',\n" +
        "f.family_member_name AS 'farmer_insurance_info.family_member_name',\n" +
        "f.family_member_id_card AS 'farmer_insurance_info.family_member_id_card',\n" +
        "f.del_flag AS 'farmer_insurance_info.del_flag'  FROM nyt_7_plot_detail_info d \n" +
        "LEFT JOIN nyt_7_farmer_insurance_info f\n" +
        "ON d.farmer_id = f.id WHERE d.id = #{id}")
    Nyt7PlotDetailInfoEx selectByIdEx(Long id);
}
